package com.javaException.demo;

import java.util.Scanner;

public class Test3 {

    public static void main(String[] args) throws LoginException {
        System.out.println("开始执行");
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入用户名");
        String username = scanner.nextLine();
        System.out.println("请输入密码");
        String password = scanner.nextLine();

        login(username, password);

        System.out.println("结束");


    }

    public static void login(String username, String password) throws LoginException {
        if (!(username.equals("admin") && password.equals("123456"))) {
            throw new LoginException("账号或密码错误");
        }
        System.out.println("登录成功");
    }

}
